package com.itcam.pro01;

import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author : Cammy.Wu
 * Description : 
 */

public class Demo02Function {


    public static void main(String[] args) {

        // 有入参，无出参——消费者
        BiConsumer<String, String> biConsumer = (x, y) -> {
            System.out.println(x + y);
        };
        biConsumer.accept("nono", "fuckup");

        // 有入参，有出参——多功能函数
        Function<String, Integer> function = (String x) -> Integer.parseInt(x);
        System.out.println(function.apply("3"));

        // 无入参，有出参——普通函数
        Runnable runnable = () -> System.out.println("小啾啾");
        new Thread(runnable).start();

        // 无入参，无出参——提供者
        Supplier<String> supplier = () -> UUID.randomUUID().toString();
        String s=supplier.get();
        System.out.println("s = " + s);
    }
}
